#include <cstdio>
using namespace std;

int main()
{
    int num;
    while (true) {
        int sum = 0, temp;
        scanf(" %d", &num);
        if (num == 0) 
            break;
        for (int i = 0; i < num; i++) {
            scanf(" %d", &temp);
            sum += temp;
        }
        printf("%d\n", sum);
    }

    return 0;
}